const http = require("http");

const server = http.createServer((req, res) => {
  res.writeHead(200, { "Content-Type": "text/plain" });
  res.end("Port 9000 is occupied for testing");
});

server.listen(9000, () => {
  console.log("Port 9000 is now occupied");
});

server.on("error", (err) => {
  if (err.code === "EADDRINUSE") {
    console.error("Port 9000 is already in use");
  } else {
    console.error("Server error:", err.message);
  }
});
